Coronavirus Pandemia Course in 2020

Notebook code prepared by Jacob Tlalka with some after adjustments from L.Tlalka - 2020, April

In [1]:
import math
import datetime
import requests
import wget
import os
import pandas as pd
from bs4 import BeautifulSoup
import plotly.offline as py

Basic data analysis

In [2]:
COUNTRIES_OF_INTEREST = ['Poland', 'Czech Republic', 'United Kingdom', 'Switzerland', 'Japan',
                         'United States', 'France', 'Italy', 'Spain', 'Germany', 'Netherlands',
                         'Iran', 'India', 'Norway', 'South Korea', 'Sweden',
                         'Belgium', 'Austria', 'Denmark', 'China']
In [3]:
# getting data with arrays of pandemia cases from the 31.12.2019 listed for each country on the
# globe (complete set of countries) 
if os.path.exists('total_cases.csv'):
    os.remove('total_cases.csv')
DATA_URL = 'https://covid.ourworldindata.org/data/ecdc/total_cases.csv'
wget.download(DATA_URL) # easy for downloading files without need opening the destination file!
Out[3]:
'total_cases.csv'
In [4]:
df = pd.read_csv('total_cases.csv')
DAYS = df.shape[0]
DATE = df['date'][DAYS - 1]
print(DAYS, DATE)
#df.shape
df.tail(3)
106 2020-04-14
Out[4]:
date World Afghanistan Albania Algeria Andorra Angola Anguilla Antigua and Barbuda Argentina ... United States United States Virgin Islands Uruguay Uzbekistan Vatican Venezuela Vietnam Yemen Zambia Zimbabwe
103 2020-04-12 1734913 555.0 433.0 1825.0 622.0 19.0 3.0 21.0 2137.0 ... 529951 51.0 501.0 796.0 8.0 175.0 258.0 1.0 40.0 14.0
104 2020-04-13 1807303 607.0 446.0 1914.0 638.0 19.0 3.0 21.0 2203.0 ... 557571 51.0 512.0 865.0 8.0 181.0 262.0 1.0 43.0 14.0
105 2020-04-14 1873265 665.0 467.0 1983.0 646.0 19.0 3.0 23.0 2272.0 ... 582594 51.0 521.0 998.0 8.0 189.0 265.0 1.0 45.0 17.0

3 rows × 208 columns

In [5]:
# deleting 2 columns loaded to dataframe as not being the country names
countries = list(df.columns)
countries = list(set(countries).difference(set(['date','World'])))
len(countries)
#sorted(countries)
Out[5]:
206
In [6]:
# scraping the still refreshed numbers on pandemia course from the most actual set of data
# run in the table on www.worldometers page
soup = BeautifulSoup(
    requests.get('https://www.worldometers.info/coronavirus/').content, 'html.parser')
main_table = soup.find(id='main_table_countries_today').find_all('tr')
In [7]:
# preparing coherent names for both sources of data - to be used further
COUNTRY_MAP = {
    'S. Korea': 'South Korea',
    'UK': 'United Kingdom',
    'USA': 'United States',
    'UAE': 'United Arab Emirates',
    'Czechia': 'Czech Republic',
}
In [8]:
# selecting columns from the main table + cleaning - for potential using in further analysis
t_col_tags = list(main_table[0].children)[1::2]
table_col_names = [value.text.replace('\xa0','al').replace('\n','').strip() 
                  for index, value in enumerate(t_col_tags)]
col_names = list(enumerate(table_col_names))
for i, col in col_names: print(f'{i}. {col}')
0. Country,Other
1. TotalCases
2. NewCases
3. TotalDeaths
4. NewDeaths
5. TotalRecovered
6. ActiveCases
7. Serious,Critical
8. TotalCases/1M pop
9. Deaths/1M pop
10. TotalTests
11. Tests/1M pop
12. Continent
In [9]:
# preparing two sets of data separately for continents and for countries
continents_table = main_table[1:7] + [main_table[8]] #index 7 has unknown, not meaningful data
countries_table = main_table[9:]
world_values = [value.text for value in list(main_table[8].children)[1::2]]
In [10]:
for name, value in zip(table_col_names, world_values):
    print(f'{name}:  {value}')
Country,Other:  World
TotalCases:  2,013,918
NewCases:  +16,058
TotalDeaths:  127,587
NewDeaths:  +987
TotalRecovered:  491,765
ActiveCases:  1,394,566
Serious,Critical:  51,527
TotalCases/1M pop:  258
Deaths/1M pop:  16.4
TotalTests:  
Tests/1M pop:  
Continent:  All
In [11]:
# using data from continents_table to prepare it for visualization
cont_scores, cont_deaths = {}, {}
cont_names = []
for row in continents_table:
    row_tags = list(row.children)[1::2]
    row = [value.text.strip() for value in row_tags]
    continent, death_cnt = row[12], row[3]
    cont_names.append(continent)
    cases = int(row[1].replace(',', ''))
    cont_scores[continent] = cases
    if death_cnt:
        cont_deaths[continent] = int(death_cnt.replace(',',''))
print(cont_names)
['North America', 'Europe', 'Asia', 'South America', 'Australia/Oceania', 'Africa', 'All']
In [12]:
# selecting some data from countries table
country_scores, deaths, population = {}, {}, {}
# dictionary for continents and total population
cont_pop = {continent:0 for continent in cont_names}
for row in countries_table:
    row_tags = list(row.children)[1::2]
    row = [value.text.strip() for value in row_tags]
    country, death_cnt, continent = row[0], row[3], row[12]
    country = COUNTRY_MAP.get(country, country)
    cases = int(row[1].replace(',',''))
    country_scores[country] = cases
    if death_cnt:
        deaths[country] = int(death_cnt.replace(',',''))
    density = row[8].replace(',','')
    if density:
        population[country] = round(cases * 10**6 / float(density), 0)
        cont_pop[continent] += population[country]
In [13]:
#country_scores
In [14]:
for country in ['Poland','Czech Republic','Slovakia','Germany','Ukraine','Lithuania','Sweden']:
    print(f'{country}: {country_scores[country]} cases')
Poland: 7408 cases
Czech Republic: 6151 cases
Slovakia: 863 cases
Germany: 132210 cases
Ukraine: 3764 cases
Lithuania: 1091 cases
Sweden: 11445 cases
In [15]:
print(f"Number of countries: {len(country_scores)}\n")
c_name = 'Spain'
print(f"Country name: {c_name}\t All cases: {country_scores[c_name]}\
\tDeaths: {deaths[c_name]}\tPopulation: {population[c_name]}\n")
print('Calculated population on continents:')
for k,v in cont_pop.items(): print(f'{k}: {v:,}')
Number of countries: 213

Country name: Spain	 All cases: 177633	Deaths: 18579	Population: 46757831.0

Calculated population on continents:
North America: 589,662,646.0
Europe: 747,518,756.0
Asia: 4,690,552,671.0
South America: 429,740,500.0
Australia/Oceania: 41,766,696.0
Africa: 1,339,901,746.0
All: 7,793,800,310.0
In [16]:
# present data for continents aggregated into the pandas dataframe
cont_df = pd.DataFrame(
    zip(cont_names, cont_pop.values(), cont_scores.values(), cont_deaths.values()),
        columns=['Continent','Population','Total cases', 'Death cases'])
cont_df['Total Cases/1M pop'] = round(cont_df['Total cases'] / cont_df['Population'] * 10**6, 0)
cont_df['Death Cases/1M pop'] = round(cont_df['Death cases'] / cont_df['Population'] * 10**6, 0)
In [17]:
cont_df
Out[17]:
Continent Population Total cases Death cases Total Cases/1M pop Death Cases/1M pop
0 North America 5.896626e+08 656863 27786 1114.0 47.0
1 Europe 7.475188e+08 948291 84429 1269.0 113.0
2 Asia 4.690553e+09 324784 11874 69.0 3.0
3 South America 4.297405e+08 58330 2535 136.0 6.0
4 Australia/Oceania 4.176670e+07 7924 72 190.0 2.0
5 Africa 1.339902e+09 17005 877 13.0 1.0
6 All 7.793800e+09 2013918 127587 258.0 16.0
In [18]:
# plot for continents data with plotly.graph_objects
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(rows=1, cols=2, subplot_titles=['Total cases', 'Death cases'])
fig.add_trace(go.Bar(
    x=cont_df['Continent'], y=cont_df['Total Cases/1M pop'], showlegend=False), 
    row=1, col=1)
fig.add_trace(go.Bar(
    x=cont_df['Continent'], y=cont_df['Death Cases/1M pop'], showlegend=False),
    row=1, col=2)
fig.update_layout(
    title=dict(text='Pandemia numbers per 1M of population for each continent', x=0.5))
fig.show()

Preparing data for visualization with respect to the course of pandemia

In [19]:
# adding - to 'country_scores'- names of countries from 'total_cases.csv' which are not present
# in statistics of www.worldometers + listing names of those countries
no_score = []
for country in countries:
    if country not in country_scores:
        country_scores[country] = None
        no_score.append(country)
print("Number of countries in country_score dictionary:", len(country_scores))
print()
print(f"{len(no_score)} countries from 'total_cases.csv' list has been added to \
'country_scores' dictionary with None values:")
print()
print(no_score)
Number of countries in country_score dictionary: 234

21 countries from 'total_cases.csv' list has been added to 'country_scores' dictionary with None values:

['Guernsey', 'Saint Vincent and the Grenadines', 'Jersey', 'Northern Mariana Islands', 'Bonaire Sint Eustatius and Saba', 'Guam', 'Vatican', 'Macedonia', 'Sint Maarten (Dutch part)', 'Cape Verde', "Cote d'Ivoire", 'Democratic Republic of Congo', 'Curacao', 'Kosovo', 'Puerto Rico', 'Turks and Caicos Islands', 'United States Virgin Islands', 'Central African Republic', 'Swaziland', 'International', 'Timor']
In [20]:
# removing from country_scores dictionary countries not listed in dataframe 'df' 
countries_removed = []
countries_with_scores = list(country_scores.keys())
for country in countries_with_scores:
    if country not in countries:
        countries_removed.append((country, country_scores.pop(country)))
country_scores['World'] = None
country_scores['date'] = str((datetime.datetime.strptime(DATE, "%Y-%m-%d") + datetime.timedelta(days=1)).date())
print(f"Current number of countries in 'country_scores' dictionary: {len(country_scores)}")
print()
print(f"{len(countries_removed)} countries removed from the 'country_scores' dictionary as not listed in 'total_cases.csv':\n", countries_removed)      
Current number of countries in 'country_scores' dictionary: 208

28 countries removed from the 'country_scores' dictionary as not listed in 'total_cases.csv':
 [('Hong Kong', 1017), ('North Macedonia', 908), ('Diamond Princess', 712), ('Ivory Coast', 638), ('Channel Islands', 440), ('Réunion', 391), ('DRC', 241), ('Mayotte', 217), ('Martinique', 158), ('Guadeloupe', 145), ('French Guiana', 86), ('Sint Maarten', 52), ('Macao', 45), ('Saint Martin', 32), ('Eswatini', 15), ('Curaçao', 14), ('St. Vincent Grenadines', 12), ('Cabo Verde', 11), ('CAR', 11), ('Turks and Caicos', 10), ('MS Zaandam', 9), ('Vatican City', 8), ('Timor-Leste', 8), ('St. Barth', 6), ('Western Sahara', 6), ('Caribbean Netherlands', 3), ('Saint Pierre Miquelon', 1), ('Total:', 2013918)]
In [21]:
# new dataframe with only one day date representing present values from 'country_scores' 
# dictionary and index number as the next value of df dataframe index 
country_scores_df = pd.DataFrame(country_scores, index=[df.shape[0]], columns=df.columns)
country_scores_df['World'] = int(world_values[1].replace(',',''))
country_scores_df
Out[21]:
date World Afghanistan Albania Algeria Andorra Angola Anguilla Antigua and Barbuda Argentina ... United States United States Virgin Islands Uruguay Uzbekistan Vatican Venezuela Vietnam Yemen Zambia Zimbabwe
106 2020-04-15 2013918 784 494 2070 659 19 3 23 2443 ... 614246 NaN 492 1214 NaN 197 267 1 45 18

1 rows × 208 columns

In [22]:
# adding 2 dataframes vertically gives the uniformed dataframe containing data of both sources
latest_df = pd.concat([df, country_scores_df], axis=0)
print(latest_df.shape)
latest_df.tail(3)
(107, 208)
Out[22]:
date World Afghanistan Albania Algeria Andorra Angola Anguilla Antigua and Barbuda Argentina ... United States United States Virgin Islands Uruguay Uzbekistan Vatican Venezuela Vietnam Yemen Zambia Zimbabwe
104 2020-04-13 1807303 607.0 446.0 1914.0 638.0 19.0 3.0 21.0 2203.0 ... 557571 51 512.0 865.0 8 181.0 262.0 1.0 43.0 14.0
105 2020-04-14 1873265 665.0 467.0 1983.0 646.0 19.0 3.0 23.0 2272.0 ... 582594 51 521.0 998.0 8 189.0 265.0 1.0 45.0 17.0
106 2020-04-15 2013918 784.0 494.0 2070.0 659.0 19.0 3.0 23.0 2443.0 ... 614246 NaN 492.0 1214.0 NaN 197.0 267.0 1.0 45.0 18.0

3 rows × 208 columns

In [23]:
# smoothing data: first counting differences from the day before (in a rolling way) and next
# taking mean values using rolling for 6 days
diff_df = latest_df.rolling(2).apply(lambda x: x[1] - x[0], raw=True).rolling(6).mean().round(0)
In [24]:
diff_df.tail(3)
Out[24]:
World Afghanistan Albania Algeria Andorra Angola Anguilla Antigua and Barbuda Argentina Armenia ... United Arab Emirates United Kingdom United States Uruguay Uzbekistan Venezuela Vietnam Yemen Zambia Zimbabwe
104 81720.0 45.0 12.0 82.0 19.0 0.0 0.0 1.0 96.0 30.0 ... 341.0 5445.0 31562.0 16.0 78.0 4.0 3.0 NaN 1.0 1.0
105 80230.0 50.0 14.0 86.0 17.0 0.0 0.0 1.0 93.0 31.0 ... 360.0 5563.0 30631.0 16.0 82.0 4.0 2.0 NaN 1.0 1.0
106 89517.0 60.0 16.0 83.0 16.0 0.0 0.0 1.0 108.0 38.0 ... 379.0 5523.0 30352.0 6.0 110.0 5.0 3.0 NaN 1.0 1.0

3 rows × 186 columns

In [25]:
# similar as above but instead of differences there is counted rolling percent for daily changes
diff_prc_df = latest_df.rolling(2).apply(
                    lambda x: (x[1] / x[0] - 1.0) * 100.0, raw=True).rolling(6).mean().round(0)
In [26]:
list(diff_prc_df['Italy'][-15:])
Out[26]:
[6.0, 5.0, 5.0, 4.0, 4.0, 4.0, 4.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0]
In [27]:
H = 24
# smoothed_df has values counted by algorithm in lambda function(to simulate tendency)
# and then they are shifted to the row of the day before
smoothed_df = latest_df.rolling(3).apply(
    lambda x: round(x[0] * 0.1 + x[1] * 0.5 + x[2] * 0.4, 0), raw=True).shift(-1)
smoothed_df.tail()
Out[27]:
World Afghanistan Albania Algeria Andorra Angola Anguilla Antigua and Barbuda Argentina Armenia ... United Arab Emirates United Kingdom United States Uruguay Uzbekistan Venezuela Vietnam Yemen Zambia Zimbabwe
102 1676954.0 531.0 422.0 1777.0 608.0 19.0 3.0 21.0 2032.0 947.0 ... 3473.0 73240.0 509364.0 495.0 689.0 175.0 257.0 1.0 40.0 12.0
103 1755698.0 572.0 436.0 1854.0 626.0 19.0 3.0 21.0 2147.0 982.0 ... 3853.0 80234.0 538160.0 505.0 806.0 177.0 260.0 1.0 41.0 14.0
104 1826449.0 625.0 453.0 1933.0 640.0 19.0 3.0 22.0 2224.0 1019.0 ... 4244.0 85487.0 564818.0 514.0 911.0 184.0 263.0 1.0 44.0 15.0
105 1922930.0 707.0 476.0 2011.0 650.0 19.0 3.0 23.0 2334.0 1065.0 ... 4646.0 90288.0 592752.0 508.0 1071.0 191.0 266.0 1.0 45.0 17.0
106 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

5 rows × 186 columns

In [28]:
# supplementing the last row of NaN values with data of the last day in 'latest_df' dataframe plus
# adding 'date' column
smoothed_df.iloc[-1] = latest_df.iloc[-1]
smoothed_df['date'] = latest_df['date']
smoothed_df.tail()
Out[28]:
World Afghanistan Albania Algeria Andorra Angola Anguilla Antigua and Barbuda Argentina Armenia ... United Kingdom United States Uruguay Uzbekistan Venezuela Vietnam Yemen Zambia Zimbabwe date
102 1676954.0 531.0 422.0 1777.0 608.0 19.0 3.0 21.0 2032.0 947.0 ... 73240.0 509364.0 495.0 689.0 175.0 257.0 1.0 40.0 12.0 2020-04-11
103 1755698.0 572.0 436.0 1854.0 626.0 19.0 3.0 21.0 2147.0 982.0 ... 80234.0 538160.0 505.0 806.0 177.0 260.0 1.0 41.0 14.0 2020-04-12
104 1826449.0 625.0 453.0 1933.0 640.0 19.0 3.0 22.0 2224.0 1019.0 ... 85487.0 564818.0 514.0 911.0 184.0 263.0 1.0 44.0 15.0 2020-04-13
105 1922930.0 707.0 476.0 2011.0 650.0 19.0 3.0 23.0 2334.0 1065.0 ... 90288.0 592752.0 508.0 1071.0 191.0 266.0 1.0 45.0 17.0 2020-04-14
106 2013918.0 784.0 494.0 2070.0 659.0 19.0 3.0 23.0 2443.0 1111.0 ... 93873.0 614246.0 492.0 1214.0 197.0 267.0 1.0 45.0 18.0 2020-04-15

5 rows × 187 columns

In [29]:
# simulating the change in data by taking hour units (not real values but counted as algorithm below)
sdf = smoothed_df.copy().drop(['date'], axis=1)
sers = []
for date in range(len(sdf) - 1):
    for h in range(H):
        sers.append(round((sdf.iloc[date] * (H - h) + sdf.iloc[date + 1] * h) / H, 1))
hour_df = pd.concat(sers, axis=1).T
hour_df.tail()
Out[29]:
World Afghanistan Albania Algeria Andorra Angola Anguilla Antigua and Barbuda Argentina Armenia ... United Arab Emirates United Kingdom United States Uruguay Uzbekistan Venezuela Vietnam Yemen Zambia Zimbabwe
2539 1994962.2 768.0 490.2 2057.7 657.1 19.0 3.0 23.0 2420.3 1101.4 ... 4873.2 93126.1 609768.1 495.3 1184.2 195.8 266.8 1.0 45.0 17.8
2540 1998753.3 771.2 491.0 2060.2 657.5 19.0 3.0 23.0 2424.8 1103.3 ... 4885.2 93275.5 610663.7 494.7 1190.2 196.0 266.8 1.0 45.0 17.8
2541 2002544.5 774.4 491.8 2062.6 657.9 19.0 3.0 23.0 2429.4 1105.2 ... 4897.1 93424.9 611559.2 494.0 1196.1 196.2 266.9 1.0 45.0 17.9
2542 2006335.7 777.6 492.5 2065.1 658.2 19.0 3.0 23.0 2433.9 1107.2 ... 4909.1 93574.2 612454.8 493.3 1202.1 196.5 266.9 1.0 45.0 17.9
2543 2010126.8 780.8 493.2 2067.5 658.6 19.0 3.0 23.0 2438.5 1109.1 ... 4921.0 93723.6 613350.4 492.7 1208.0 196.8 267.0 1.0 45.0 18.0

5 rows × 186 columns

In [30]:
def select_countries(range_min=None, range_max=None, top_num=None):
    all_scores = country_scores.items()
    all_scores = list(filter(lambda x: type(x[1]) == int, all_scores))
    if range_min:
        all_scores = list(filter(lambda x: x[1] >= range_min, all_scores))
    if range_max:
        all_scores = list(filter(lambda x: x[1] <= range_max, all_scores))
    all_scores.sort(key=lambda x: x[1], reverse=True)
    if top_num:
        all_scores = all_scores[:top_num]
    return [x[0] for x in all_scores]
In [31]:
# function returns the death proportion in total number of cases
def death_ratio(country):
    if country in deaths and country in country_scores:
        return round(deaths[country] / country_scores[country],3)
    return 0.0

# displaying the countries of 60 top with its death ratio numbers 
country_drs = [(country, death_ratio(country)) for country in select_countries(top_num=60)]
country_drs.sort(key=lambda x: x[1], reverse=True)
df_drs = pd.DataFrame(country_drs*100, columns=['Country','Death_procent'])
c_d_r = list(zip(range(1,len(country_drs)+1), country_drs))
'''
print("\t\t\tThe present death ratio from CoronaVirus Pandemia in 60 top countries:")
for i, (k,v) in c_d_r:
    print(f'{i}. {k}: {v*100:.1f}%')
'''
Out[31]:
'\nprint("\t\t\tThe present death ratio from CoronaVirus Pandemia in 60 top countries:")\nfor i, (k,v) in c_d_r:\n    print(f\'{i}. {k}: {v*100:.1f}%\')\n'
In [32]:
# plot for the countries death ratios
import plotly.express as px
fig = px.bar(df_drs, x=df_drs['Country'], y=df_drs['Death_procent'], color='Death_procent',
             title=dict(text='Death percentage of pandemia top 60 countries', x=0.5))
fig.show()
In [33]:
def show_countries(with_log=True, threshold=100, selected_countries=COUNTRIES_OF_INTEREST, data=latest_df): 
    dt = data.copy()
    to_remove = list(set(['date', 'World']) & set(dt.columns))
    dt = dt.drop(to_remove, axis=1)
    for country in dt.columns:
        cdf = dt[country][~dt[country].isna()]
        if threshold:
            cdf = cdf[dt[country] >= threshold]
        cdf = cdf.reset_index()[country]
        dt.drop([country], axis=1)
        dt[country] = cdf
    
    data_1 = [{'x': dt.index, 'y': dt[col], 'name': col}
              for col in selected_countries]
    
    # additional variables to show adequate titles and axes labels
    if with_log:
        scale='logaritmic'
    else:
        scale='linear'
    #scale='logarithmic' if with_log else 'linear'
    title_var = ['Coronavirus Pandemia in Chosen Countries - in Total',
                 'Coronavirus Pandemia in Chosen Countries - Daily Trend']
    title = title_var[0] if data is latest_df or data is hour_df else title_var[1]
    y_label_var = [f'Number of cases in {scale} scale',
                   'Daily changes in number of cases',
                  'Daily percentage changes in number of cases']
    if data is latest_df or data is hour_df:
        y_label = y_label_var[0]
    elif data is diff_df:
        y_label = y_label_var[1]
    elif data is diff_prc_df:
        y_label = y_label_var[2]
    unit = 'Hours' if data is hour_df else 'Days'
      
    layout = {'title':{'text':title, 'x':0.5, 'y':0.9},
             'xaxis':{'title':f'{unit} which have gone from crossing a number of {threshold} confirmed cases'},
             'yaxis':{'title': y_label}}
    fig = {'data': data_1, 'layout': layout}
    if with_log:
        layout.update(yaxis=dict(type="log", title=y_label_var[0]))
    
    py.iplot(fig)
    #py.iplot(data_1, filename='./cufflinks/simple-line.html', image_width=800, image_height=600)
'filename' argument as above works when py.plot() is called (instead of py.iplot()) to make graph displayed in webbrowser and saved in the file with given location.
In [34]:
show_countries()
In [35]:
# total numbers for first 30 countries
for i, (cases,country) in enumerate(sorted(
    [(country_scores[country] or 0, country) for country in countries], reverse=True), 1):
    if i <= 30:
        print(f'{i}. {country} {cases}')
1. United States 614246
2. Spain 177633
3. Italy 162488
4. France 143303
5. Germany 132210
6. United Kingdom 93873
7. China 82295
8. Iran 76389
9. Turkey 65111
10. Belgium 33573
11. Netherlands 27419
12. Canada 27063
13. Switzerland 26023
14. Brazil 25684
15. Russia 24490
16. Portugal 17448
17. Austria 14280
18. Israel 12200
19. India 11555
20. Ireland 11479
21. Sweden 11445
22. South Korea 10591
23. Peru 10303
24. Japan 8100
25. Chile 7917
26. Ecuador 7603
27. Poland 7408
28. Romania 7216
29. Denmark 6681
30. Norway 6623
In [36]:
show_countries(selected_countries=select_countries(range_min=10000), data=hour_df, threshold=100, with_log=False)
In [37]:
show_countries(
    selected_countries=['Poland', 'Czech Republic', 'Italy', 'Germany', 'France', 'United Kingdom',
                        'United States', 'Spain', 'Switzerland', 'Japan'],
    data=hour_df, threshold=1000, with_log=False)
In [38]:
show_countries(selected_countries=
    ['Italy', 'Spain', 'United States', 'Poland'], data=diff_df, threshold=1, with_log=False)
In [39]:
show_countries(
    selected_countries=['Poland', 'Czech Republic'], data=diff_df, threshold=1, with_log=False)
In [40]:
show_countries(selected_countries=select_countries(top_num=10), threshold=100, data=diff_df, with_log=False)
In [41]:
show_countries(selected_countries=select_countries(top_num=30), threshold=1000, data=hour_df)
In [42]:
show_countries(selected_countries=select_countries(top_num=32), threshold=300, data=hour_df, with_log=False)
In [43]:
show_countries(selected_countries=['Poland', 'Czech Republic', 'Italy', 'Germany', 'France', 'United Kingdom', 'United States',
                                   'Spain', 'Switzerland', 'Japan'],
               data=hour_df, threshold=300, with_log=False)
In [44]:
show_countries(selected_countries=['Poland', 'Czech Republic', 'Italy', 'Germany', 'France', 'United Kingdom',
                                   'United States', 'Spain', 'Switzerland', 'Japan', 'China','India'],
               data=diff_prc_df, threshold=0, with_log=False)
In [45]:
show_countries(selected_countries=['Poland', 'Czech Republic', 'France', 'Italy', 'Spain'],
               data=diff_prc_df, threshold=0, with_log=False)